home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 4 / Amoszine 4 (Disk 2 of 3).adf / CELEBRITY_SOURCE / CELEB.lha / TextScroll.AMOS / TextScroll.amosSourceCode < prev   
AMOS Source Code  |  1992-02-26  |  5KB  |  150 lines

  1. ' Message scroller by PAUL OVERY   
  2. '
  3. ' Paul Overy 
  4. ' "Fryup Productions"
  5. ' 27 Barton Rd 
  6. ' Maidstone  
  7. ' Kent ME15 7BU
  8. '
  9. ' Please don't forget to include my name in your programs when using my algo.  
  10. '----------------------------------------------------------
  11. Set Buffer 100 : Hide 
  12. Dim A$(900) : Rem increase this for large text files 
  13. Global A$(),_NEXT_BLOCK_Y,_TEXT_BASE,_TEXT_BASE2,MORE_TEXT
  14. '----------------------------------------------------------
  15. Screen Open 0,640,256+16,2,Hires : Flash Off : Curs Off : Cls 0
  16. ' Try using a dual playfield for a background screen.  
  17. Screen Display 0,128,38,320,256
  18. Palette 0,$FFF : Double Buffer : Autoback 0
  19. Wait Vbl : Auto View Off 
  20. '--------------------
  21. FILE$="cpu.asc"
  22. '--------------------
  23. Open In 1,FILE$
  24. Set Input 10,-1 : Rem <line feed>  
  25. L=0
  26. Repeat 
  27.    Line Input #1,A$(L) : Inc L
  28. Until Eof(1)
  29. Close 1
  30. '
  31. LAST=L+2 : OFFSET_Y=0 : LINE=-2
  32. _TEXT_BASE=Text Base+256 : _TEXT_BASE2=_TEXT_BASE+8
  33. '
  34. ' ***** YOU MUST USE A FONT THATS 8 by 8 ******    
  35. '------------------------------------------------------
  36. 'Find the small font, tested on A500 & A1200.  
  37. Get Rom Fonts : Set Font 2
  38. Text 0,Text Base,"#" : If Point(8,2)=1 Then Set Font 1
  39. Cls 0,0,0 To 9,8
  40. '------------------------------------------------------
  41. Text 112,64,"Use mouse button to scroll.  Left=Slow / Right=Fast"
  42. Screen Swap : Screen Copy Physic To Logic
  43. '
  44. Colour 18,$F : Colour 22,$F : Sprite 0,X Hard(0),Y Hard(0),1
  45. Repeat 
  46.    '
  47.    SPEED=Min(Mouse Key,2)
  48.    CUT_SIZE=18*SPEED
  49.    '
  50.    If SPEED>0
  51.       '
  52.       MORE_TEXT=True : Rem time to update new text  
  53.       OFFSET_Y=0 : Rem move screen offset back  
  54.       Add LINE,2 : Rem Move through text, by two lines.   
  55.       Y=0 : Rem start copying at the top of the screen.  
  56.       OK_SWAP=True : Rem do a screen swap later on.       
  57.       '
  58.       While OFFSET_Y<16
  59.          Add OFFSET_Y,SPEED
  60.          Screen Offset 0,,OFFSET_Y
  61.          View 
  62.          If OK_SWAP=True
  63.             Screen Swap 
  64.             'logical screen now has the next scroll position ready.
  65.             OK_SWAP=False
  66.          End If 
  67.          Wait Vbl 
  68.          'Gradually update the screen in the background.
  69.          Screen Copy Physic(0),0,Y,640,Y+CUT_SIZE To Logic(0),OX,Y-16
  70.          Add Y,CUT_SIZE : Rem work down the physical screen
  71.          '----------------  
  72.          If MORE_TEXT=True
  73.             _SCENE_BOTTOM[LINE]
  74.          End If 
  75.          '----------------  
  76.       Wend 
  77.    Else 
  78.       View : Wait Vbl 
  79.    End If 
  80.    If Key State(69) Then Stop 
  81. Until LINE>LAST
  82. '
  83. 'YET AGAIN:The below procedures only support stepping speeds of 1 & 2. 
  84. 'When using faster speeds, less block sections must be used. 
  85. 'i.e. just delete some lables, and renumber them. Don't forget to change 
  86. 'the CUT_SIZE and the SPEED. 
  87. '  
  88. Procedure _SCENE_BOTTOM[LINE]
  89.    '
  90.    ' I don't know why I've used a bottom 16 pixel update area.
  91.    ' It should be the same size as the font height, oops. 
  92.    '  
  93.    ' So delete P5 to P8, change 
  94.    '
  95.    '      Screen Open 0,640,256+font_size,2,Screen
  96.    '          . 
  97.    '          . 
  98.    '      Inc LINE (not Add LINE,2) 
  99.    '          . 
  100.    '          . 
  101.    '      While OFFSET_Y<8  
  102.    '          . 
  103.    '          .     
  104.    '      bla bla....Logic(0),OX,Y-8
  105.    '  
  106.    ' I've left it this way because, because, errr, well its a laugh.
  107.    ' Ok the reason for this is so you can use a step speed of 4 pixels.   
  108.    ' Read the last comments.
  109.    '
  110.    Inc _NEXT_BLOCK_Y
  111.    '  
  112.    On _NEXT_BLOCK_Y Goto P1,P2,P3,P4,P5,P6,P7,P8
  113.    '----------------------------------- 
  114.    P1:
  115.    Cls 0,0,256 To 160,264
  116.    Text 0,_TEXT_BASE,Mid$(A$(LINE),1,20)
  117.    Pop Proc
  118.    P2:
  119.    Cls 0,160,256 To 320,264
  120.    Text 160,_TEXT_BASE,Mid$(A$(LINE),21,20)
  121.    P3:
  122.    Cls 0,320,256 To 480,264
  123.    Text 320,_TEXT_BASE,Mid$(A$(LINE),41,20)
  124.    Pop Proc
  125.    P4:
  126.    Cls 0,480,256 To 640,264
  127.    Text 480,_TEXT_BASE,Mid$(A$(LINE),61,20)
  128.    '----------------------------------- 
  129.    P5:
  130.    Cls 0,0,264 To 160,272
  131.    Text 0,_TEXT_BASE2,Mid$(A$(LINE+1),1,20)
  132.    Pop Proc
  133.    P6:
  134.    Cls 0,160,264 To 320,272
  135.    Text 160,_TEXT_BASE2,Mid$(A$(LINE+1),21,20)
  136.    P7:
  137.    Cls 0,320,264 To 480,272
  138.    Text 320,_TEXT_BASE2,Mid$(A$(LINE+1),41,20)
  139.    Pop Proc
  140.    P8:
  141.    Cls 0,480,264 To 640,272
  142.    Text 480,_TEXT_BASE2,Mid$(A$(LINE+1),61,20)
  143.    '----------------------------------- 
  144.    _NEXT_BLOCK_Y=0 : MORE_TEXT=False
  145.    '
  146.    ' To use a faster stepping speed, merge the above two blocks together.   
  147.    ' i.e delete P5: & move its contents into P1:
  148.    ' Do the same with P6: & P2: and so on... (& optimised Cls)  
  149.    '
  150. End Proc